<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../css/common.css" media="all">
	</head>
	<body>

		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">交易总额</div>
						<div class="layui-card-body">
				
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12 modelShow" data-accountname="交易总额" >
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>交易总额</h3>
												<p><cite class="total_transaction_amount">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="线上交易总额">
												<h3>线上交易总额</h3>
												<p><cite class="online_transaction">￥0.00</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="线下交易总额">
												<h3>线下交易总额</h3>
												<p><cite class="offline_transaction">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">订单总量</div>
						<div class="layui-card-body">
				
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="订单数量">
												<h3>订单数量</h3>
												<p><cite class="total_order_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="线上订单量">
												<h3>线上订单量</h3>
												<p><cite class="total_order_online">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="线下订单量">
												<h3>线下订单量</h3>
												<p><cite class="total_order_offline">0</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">积分</div>
						<div class="layui-card-body">
				
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="101,105" data-accountname="商家积分">
												<h3>商家积分</h3>
												<p><cite class="jf_amount">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="101" data-accountname="商家佣金">
												<h3>商家佣金</h3>
												<p><cite class="jf_amount_member">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="105" data-accountname="商家余额">
												<h3>商家余额</h3>
												<p><cite class="jf_amount_merchant">0</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">奖励</div>
						<div class="layui-card-body">
				
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="107,100" data-accountname="直推奖励">
												<h3>直推奖励</h3>
												<p><cite class="jfsr_money">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="100" data-accountname="间推奖励">
												<h3>间推奖励</h3>
												<p><cite class="jfsr_money_member">￥0.00</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountid="107" data-accountname="团队奖励">
												<h3>团队奖励</h3>
												<p><cite class="jfsr_money_merchant">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- <div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">今日统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>今日交易成功数量</h3>
												<p><cite class="today_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>今日交易成功金额</h3>
												<p><cite class="today_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div> -->
				<!-- <div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">昨日统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>昨日交易成功数量</h3>
												<p><cite class="yes_today_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>昨日交易成功金额</h3>
												<p><cite class="yes_today_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">本月统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>本月交易成功数量</h3>
												<p><cite style="color: #FF5722;" class="month_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>本月交易成功金额</h3>
												<p><cite style="color: #FF5722;" class="month_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">上月统计</div>
						<div class="layui-card-body">
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>上月交易成功数量</h3>
												<p><cite style="color: #5FB878;" class="prev_month_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>上月交易成功金额</h3>
												<p><cite style="color: #5FB878;" class="prev_month_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div> -->
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">会员总量</div>
						<div class="layui-card-body">
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12 memberShow" >
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>会员总量</h3>
												<p><cite class="count_member">0</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md9">
					<div class="layui-card">
						<div class="layui-card-header">商家收入</div>
						<div class="layui-col-md6">
							<div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-carousel layadmin-carousel layadmin-backlog">
										<div>
											<ul class="layui-row layui-col-space10">
												<li class="layui-col-xs12">
													<a href="javascript:;" class="layadmin-backlog-body modelShow" data-accountname="积分收入">
														<h3>积分收入</h3>
														<p><cite class="today_jf_count">0</cite></p>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-md6">
							<div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-carousel layadmin-carousel layadmin-backlog">
										<div>
											<ul class="layui-row layui-col-space10">
												<li class="layui-col-xs12">
													<a href="javascript:;" class="layadmin-backlog-body modelShow"  data-accountname="现金收入">
														<h3>现金收入</h3>
														<p><cite class="today_xj_count">0</cite></p>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>
						<!-- <div class="layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-carousel layadmin-carousel layadmin-backlog">
										<div>
											<ul class="layui-row layui-col-space10">
												<li class="layui-col-xs12">
													<a href="javascript:;" class="layadmin-backlog-body">
														<h3>间接分享收入</h3>
														<p><cite class="today_trans_count">0</cite></p>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-carousel layadmin-carousel layadmin-backlog">
										<div>
											<ul class="layui-row layui-col-space10">
												<li class="layui-col-xs12">
													<a href="javascript:;" class="layadmin-backlog-body">
														<h3>团队奖励</h3>
														<p><cite class="today_trans_count">0</cite></p>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div> -->
					</div>
					
				</div>
				<div class="layui-col-md12">
					<!-- <div class="layui-card">
						<div class="layui-card-header">数据概览</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview">
								<div carousel-item id="LAY-index-dataview">
									<div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
									<div></div>
									<div></div>
								</div>
							</div>

						</div>
					</div> -->
					<!-- <div class="layui-card">
						<div class="layui-tab layui-tab-brief layadmin-latestData">
							<ul class="layui-tab-title">
								<li class="layui-this">待发货订单</li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<table id="LAY-index-topSearch"></table>
								</div>
								<div class="layui-tab-item">
									<table id="LAY-index-topCard"></table>
								</div>
							</div>
						</div>
					</div> -->
				</div>
			
			</div>
		</div> 
		<script src="../../layuiadmin/layui/layui.js?t=1"></script>
		<script src="../../js/common.js"></script>
		<script>
			layui.config({
				base: '../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'table', 'form', 'element', 'laytpl'], function() {
				var table = layui.table,
					$ = layui.$,
					form = layui.form,
					laytpl = layui.laytpl,
					element = layui.element,
					admin = layui.admin;
					
					

				var role_id = cookie.GetCookie('role_id');
				var _data = {}
				if(role_id!='2c9280826a456cb5016a45afd0430018'){
					initdata();
				}

				function initdata() {
					$.get(server.hssd_shop_billtotal, {}, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								var data = res;
								console.log(res,"==========res")
								// $('#loginuser').html(data.name)
								$('.total_transaction_amount').html(res.total_money.data.xf_money?'￥'+res.total_money.data.xf_money:'0')
								$('.online_transaction').html(res.total_money.data.xf_online_money?'￥'+res.total_money.data.xf_online_money:'0')
								$('.offline_transaction').html(res.total_money.data.xf_offline_money?'￥'+res.total_money.data.xf_offline_money:'0')
								
								// 订单总量
								
								$('.total_order_count').html(res.total_money.data.xf_allnum?res.total_money.data.xf_allnum:'0')
								
								$('.total_order_online').html(res.total_money.data.xf_online_num?res.total_money.data.xf_online_num:'0')
								$('.total_order_offline').html(res.total_money.data.xf_offline_num?res.total_money.data.xf_offline_num:'0')
							    // 消费积分总额
								$('.jf_amount').html(res.jf_amount.data.jf_amount105?'￥'+res.jf_amount.data.jf_amount105:'0')
								$('.jf_amount_member').html(res.sum_commission.data.sum_commission?'￥'+res.sum_commission.data.sum_commission:'0')
								$('.jf_amount_merchant').html(res.ye_amount.data.ye_amount107?'￥'+res.ye_amount.data.ye_amount107:'0')
								
									
								// 奖励
								$('.jfsr_money').html(res.jfsr_money.data.jfsr_zt_money ? '￥'+res.jfsr_money.data.jfsr_zt_money : '￥0.00')
								$('.jfsr_money_member').html(res.jfsr_money.data.jfsr_jt_money ? '￥'+res.jfsr_money.data.jfsr_jt_money : '￥0.00')
								$('.jfsr_money_merchant').html(res.jfsr_money.data.jfsr_td_money ? '￥'+res.jfsr_money.data.jfsr_td_money : '￥0.00')
								//会员总量
								$('.count_member').html(res.count_member.data.count_member ? res.count_member.data.count_member : '￥0.00')

								//商家收入
								$('.today_jf_count').html(res.jfsr_money.data.jfsr_money ? '￥'+res.jfsr_money.data.jfsr_money : '￥0.00')
								$('.today_xj_count').html(res.xj_money.data.xj_money ? '￥'+res.xj_money.data.xj_money : '￥0.00')
								// $('.month_trans_sum').html(res.month_trans_count.data.pay_price ? '￥'+res.month_trans_count.data.pay_price : '￥0.00')
								// $('.prev_month_trans_sum').html(res.prev_month_trans_count.data.pay_price ? '￥'+res.prev_month_trans_count.data.pay_price : '￥0.00') 
//								element.init();
								
								
								//今日待发货订单
								// table.render({
								// 	elem: '#LAY-index-topSearch',
								// 	page: true,
								// 	data: res.ls_orders.data,
								// 	cols: [
								// 		[{
								// 		field: 'orderid',
								// 		width: 120,
								// 		title: '订单编号'
								// 	}, {
								// 		field: 'memberid',
								// 		width: 100,
								// 		title: '会员ID',
								// 		sort: true
								// 	},{
								// 		field: 'userid',
								// 		width: 100,
								// 		title: '用户ID',
								// 		sort: true
								// 	},  {
								// 		field: 'pay_price',
								// 		width: 120,
								// 		title: '支付金额',
								// 		totalRow: true
								// 	}, {
								// 		field: 'quantity',
								// 		width: 120,
								// 		title: '商品数量',
								// 		totalRow: true
								// 	}, {
								// 		field: 'consignee',
								// 		title: '收货人',
								// 	}, {
								// 		field: 'mobile',
								// 		title: '联系电话',
								// 	}, {
								// 		field: 'areaname',
								// 		title: '收货地址',
								// 		templet: function(d) {
								// 			return d.areaname?d.areaname:'' + d.address?d.address:''
								// 		}
								// 	}, {
								// 		field: 'notes',
								// 		width: 120,
								// 		title: '用户备注',
								// 	}, {
								// 		field: 'addtime',
								// 		width: 160,
								// 		title: '下单时间'
								// 	}, ]
								// 	],
								// 	parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
								// 		return {
								// 			"code": res.code, //解析接口状态
								// 			"msg": res.msg, //解析提示文本
								// 			"count": res.orders.pager.total, //解析数据长度
								// 			"data": res.orders.data //解析数据列表
								// 		};
								// 	}
								// });
								
//								//最近7天新增商户
//								table.render({
//									elem: '#LAY-index-topCard',
//									data: res.week_merchant_list.data,
//									page: true,
//									cols: [
//										[{
//											field: 'name',
//											title: '商户名称',
//										}, {
//											field: 'mobile',
//											title: '联系电话',
//										}, {
//											field: 'pos_sn',
//											title: 'SN号',
//										}, {
//											field: 'product',
//											title: '产品类型',
//										}, {
//											field: 'addtime',
//											title: '创建时间',
//											sort: true
//										}]
//									],
//									parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
//										return {
//											"code": res.code, //解析接口状态
//											"msg": res.msg, //解析提示文本
//											"count": res.week_merchant_list.pager.total, //解析数据长度
//											"data": res.week_merchant_list.data //解析数据列表
//										};
//									}
//								});
								
							} else {
								layer.msg(res.msg);
							}
							closeloading();
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				$(`.modelShow`).on('click', function() {
					console.log($(this).data('accountname'));
					let type=''
					let scene='';
					// if($(this).data('accountname')=='线上交易总额' || $(this).data('accountname')=='线上总订单'){
					// 	scene=1
					// }else if($(this).data('accountname')=='线下交易总额' || $(this).data('accountname')=='线下总订单'){
					// 	scene=2
					// }
					// if($(this).data('accountname')=='线上交易总额'||$(this).data('accountname')=='线下交易总额'||$(this).data('accountname')=='交易总额'){
					// 	type=1
					// }else if($(this).data('accountname')=='订单数量'||$(this).data('accountname')=='线上订单量'||$(this).data('accountname')=='线下订单量'){
					// 	type=2
					// }else if($(this).data('accountname')=='直推奖励'||$(this).data('accountname')=='间推奖励'||$(this).data('accountname')=='团队奖励'){
					// 	type=3
					// }else if($(this).data('accountname')=='商家积分'||$(this).data('accountname')=='商家佣金'||$(this).data('accountname')=='商家余额'){
					// 	type=4
					// }
					console.log($(this).data('accountname'),"==========")
					if($(this).data('accountname')=='线上交易总额'||$(this).data('accountname')=='线下交易总额'||$(this).data('accountname')=='交易总额' || $(this).data('accountname')=='订单数量'||$(this).data('accountname')=='线上订单量'||$(this).data('accountname')=='线下订单量'){
						type=1
						scene=$(this).data('accountname')
					}else{
						type=""
						scene=$(this).data('accountname')
					}
					console.log(type,'eeeeeeeee')
						layer.open({
							type: 2,
							title: $(this).data('accountname'),
							shadeClose: false,
							shade: 0.5,
							area: ['90%', '90%'],
							content:'model/detailstree.html?scene=' + scene+'&type='+type,
							end: function() {}
						});
					// }
					// if(type==1){
					// 	layer.open({
					// 		type: 2,
					// 		title: $(this).data('accountname'),
					// 		shadeClose: false,
					// 		shade: 0.5,
					// 		area: ['90%', '90%'],
					// 		content:scene!=='' ? 'model/detailstree.html?scene=' + scene+'&type='+type : 'model/detailstree.html?type=' + type,
					// 		end: function() {}
					// 	});
					// }else if(type==3 || type==4){
					// 	layer.open({
					// 		type: 2,
					// 		title: $(this).data('accountname'),
					// 		shadeClose: false,
					// 		shade: 0.5,
					// 		area: ['90%', '90%'],
					// 		content:'model/detailstree.html?id=' + $(this).data('accountid')+'&type='+type,
					// 		end: function() {}
					// 	});
					// }
					
				})
				$(`.memberShow`).on('click', function() {
					layer.open({
						type: 2,
						title: '会员总量',
						shadeClose: false,
						shade: 0.5,
						area: ['90%', '90%'],
						content:'model/membertree.html',
						end: function() {}
					});
					
				})
				
			});
		</script>
	</body>
</html>
